<?php
class Logger
{	
	public static function log($title, $msg = NULL)
	{
		$filename = BASE_PATH . "/logs/log.txt";
		// open file
		$fd = fopen($filename, "a");
		// append date/time to message
		ob_start();
		var_dump($msg);
		$contents=ob_get_contents();
		$str = "-- $title";
		//$str = "[" . date('Y-m-d H:i:s') .  "] - $title";
		if ($msg != NULL && $msg != '')
		{
			$str = $str . "  ---  " . $contents;
		}
		ob_end_clean();
		// write string
		fwrite($fd, $str . "\r\n");
		// close file
		fclose($fd);
	}
}